<template>
  <div class="user-info">

    <div v-if='!this.userInfo.img'>
      <img src="~assets/img/profile/avatar.svg" alt="" class='avatar' >
    </div>
    <div v-else>
      <img src="~assets/img/login/buddha.svg" alt="" class='avatar' >
    </div>

    

    
    <div class="info">
      <div v-if='!this.userInfo.img'>
        <div class="login">登录/注册</div>
        <div class="phone">
          <img src="~assets/img/profile/phone.svg" alt="">
          <span>暂无绑定手机号</span>
        </div>
      </div>
      <div v-else>
        <div class="login">{{this.userInfo.userName}}</div>
        <div class="phone">
          <span>{{this.userInfo.phone}}</span>
        </div>
      </div>


    </div>
    <div class="arrow" @click='loginClick'>
      <img src="~assets/img/common/arrow-left.svg" alt="">
    </div>
  </div>
</template>

<script>
export default {
  name: 'UserInfo',
  date() {
    return {
    }
  },
  props: {
    userInfo: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  methods: {
    loginClick() {
      // 发射 请求登录事件
      this.$emit('loginClick')
    }
  },
  created() {
    
  },
  mounted() {
    
  }
}
</script>

<style scoped>
.user-info {
  height: 85px;
  background-color: var(--color-tint);
  color: #fff;
  padding: 6px 15px;

  display: flex;
}

.user-info .avatar {
  width: 70px;
  height: 70px;
}

.info {
  padding-left: 15px;
  flex: 1;
}

.info .login {
  margin-top: 15px;
}

.phone img {
  width: 20px;
  height: 30px;
  vertical-align: middle;
  margin-left: -5px;
}

.phone span {
  font-size: 13px;
}

.arrow {
  width: 20px;
  line-height: 85px;
}

.arrow img {
  width: 20px;
}
  </style>